/**
 * Created by ranchenguang on 2017/09/14.
 * vue 组件注册
 */
import Vue from 'vue'
import Util from '../util/index'
import {Toast, MessageBox} from 'mint-ui'

import xgdHeader from '../component/header.vue'
import xgdCellLink from '../component/cell-link.vue'
import xgdPopupPiker from '../component/popup-piker.vue'
import xgdNoData from '../component/no-data.vue'

import vIScroll from '../directive/iscroll'

document.addEventListener('touchmove', function (e) {
  e.preventDefault();
}, false);

Vue.use(vIScroll, {
  // useTransition:false,
  // useTransform:false,
  preventDefault: false,
  preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT|A)$/ },
  mouseWheel: false,
  // click: true,
  // tap: true
})

Vue.component('xgdHeader', xgdHeader);
Vue.component('xgdCellLink', xgdCellLink);
Vue.component('xgdPopupPiker', xgdPopupPiker);
Vue.component('xgdNoData', xgdNoData);

//用于整个项目中的事件管理与派发，事件标志需唯一
window.EventManage = new Vue();

//插件方式添加全局方法
let plugin = {};
plugin.install = function (Vue, options) {
  Vue.prototype.$toast = Toast;
  Vue.prototype.$message = MessageBox;
  Vue.prototype.$util = Util;
  Vue.prototype.$bus = window.EventManage;
};
Vue.use(plugin);
